﻿define([
    'Wjs/Wjs'
],
function () {
    'use strict';

    return Wjs.defineOnce({

        type: 'Notifier',

        internal: {

            construct: function () {

                this.views = []; // The instances of the views that need to be notified
            }
        },

        subscribe: function (view) {

            this.views.push(view);
        },

        unSubscribe: function (view) {

            this.views.forEach(function (v, i) {

                if (v === view) {

                    this.views.splice(i, 1);
                }
            },
            this);
        }

    });

});